%*******************************************************************************
%  style.cls
%
%  LaTeX-Dokumentenklasse fuer Seminararbeiten
%
%*******************************************************************************


\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{style}[]

% load class
\LoadClass[a4paper,11pt,titlepage]{article}

% load packages

\RequirePackage{wrapfig}

%\RequirePackage[ngerman]{babel}
\usepackage[utf8]{inputenc}
\RequirePackage[activate={true,nocompatibility}]{microtype}
\RequirePackage{tabularx}
\RequirePackage{amsfonts}
\RequirePackage{floatflt}
\RequirePackage[pdftex]{color,graphicx}
\RequirePackage{amssymb}
\RequirePackage{amsmath}
\RequirePackage{hangcaption}
\RequirePackage{times}
\RequirePackage{setspace}
\RequirePackage[]{caption}
\RequirePackage{hyperref}
\RequirePackage{subfigure}

% define colors
\definecolor{darkblue}{rgb}{0,0,.5}
\definecolor{Comment}{rgb}{0.55, 0.2, 0.0}
\definecolor{JavaDoc}{rgb}{0.0, 0.25, 0.10}
\definecolor{Keyword1}{rgb}{0.0, 0.0, 0.4}
\definecolor{Keyword2}{rgb}{0.0, 0.0, 0.4}
\definecolor{Keyword3}{rgb}{0.0, 0.0, 0.4}
\definecolor{Keyword4}{rgb}{0.0, 0.0, 0.4}
\definecolor{Identifier}{rgb}{0.0, 0.0, 0.0}
\definecolor{Text}{rgb}{0.0, 0.0, 0.0}

\hypersetup{
	plainpages=false,
	linkcolor=darkblue,
	citecolor=darkblue,
	urlcolor=darkblue,
	breaklinks=true,
	colorlinks=true,
	citebordercolor=0 0 0,
	filebordercolor=0 0 0,
	linkbordercolor=0 0 0,
	menubordercolor=0 0 0,
	urlbordercolor=0 0 0,
	pdfhighlight=/I
}

% captions should be italic and bold
\renewcommand\captionfont{\small\itshape}
\renewcommand\captionlabelfont{\bf\upshape}

% custom commands
\def\sfrac#1#2{
\text{\hspace{3pt}\!\!\!$^{#1}\!\!\hspace{1pt}/\hspace{2pt}\!\!_{#2}$\!\!\!\hspace{3pt}}
}
\newcommand{\vect}[1]{ \{ \vec{#1}_1, ... , \vec{#1}_n\} }
\newcommand{\el}[2]{ \underset{\in #2}{#1} }
\newcommand{\la}{\lambda_1}
\newcommand{\lb}{\lambda_2}
\newcommand{\lc}{\lambda_3}
\newcommand{\ld}{\lambda_4}
\newcommand{\real}[1]{\mathbb{R}^{#1}}

\newcommand{\itm}[1]{ \item{\textbf{#1}} }

\newcommand{\bx}[2]{	\begin{samepage}
						\paragraph{#1.\\[5pt]}
						\indent
						\parbox{12cm}{
						\ttfamily{#2}}
						\end{samepage}\\
					}
\newcommand{\code}[1]{	\scriptsize
						\texttt{#1}
						\normalsize
					}
\newcommand{\inlinecode}[1]{
						\texttt{#1}
					}
\newcommand{\pro}{\rmfamily\color{Identifier}\noindent}
\newcommand{\ret}{	\hangindent=1cm
					\hangafter=0
					\noindent
					\ttfamily\color{Comment}}
\newcommand{\inp}{\vspace{3pt}\ttfamily\color{Keyword1}\noindent}
\newcommand{\TODO}[1]{...\color{Comment} To do: #1 \color{Text} }
\newcommand{\ANS}[1]{	\color{JavaDoc} #1 \color{Text} }
\newcommand{\vecto}[1]{ \vec{#1} = \{ #1_1, ... , #1_n\}, \quad #1_i \in \real }
\newcommand{\fref}[1]{Fig.\ \ref{#1}}
\newcommand{\refref}[1]{\nameref{#1} on page \pageref{#1}}

\newcommand{\fig}[3]{\begin{figure}[!h]
	\centering
		\includegraphics[width=\textwidth]{#1}
	\caption{\small #2}
	\label{#3}
\end{figure}}

% source code listings
\usepackage{listings}
\lstloadlanguages{Java}
\lstloadlanguages{Haskell}
\lstloadlanguages{C}
\lstset{language=java,
	basicstyle=\scriptsize\rmfamily,
	keywordstyle=\rmfamily\color{Keyword1},
	keywordstyle=[1]\bfseries\color{Keyword1},
	keywordstyle=[2]\bfseries\color{Keyword2},
	keywordstyle=[3]\bfseries\color{Keyword3},
	keywordstyle=[4]\bfseries\color{Keyword4},
	commentstyle=\color{Comment}\ttfamily\itshape,
	identifierstyle=\color{Identifier},
	stringstyle=\ttfamily,
	showstringspaces=false,
	breaklines=true,
	firstline=2,
	tabsize=4,
	numbers=left,
	numberstyle=\tiny,
	numbersep=10pt,
	stepnumber=1,
	firstnumber=1,	% auto | last | <number>
	numberfirstline=true,
	extendedchars=true,
	xleftmargin=0pt,
	escapechar=~,
	mathescape=true,
	moredelim=**[is][\ttfamily\color{JavaDoc}]{~}{~},
%	morecomment=[s][\ttfamily]{~}{~},
%	morecomment=[l][\color{Comment}\itshape]{//},
%	morecomment=[s][\color{Comment}\itshape]{/*}{*/},
%	morecomment=[s][\color{JavaDoc}\itshape]{/**}{*/},
%	morecomment=[s][\color{JavaDoc}\itshape]{/**}{`},
%	morecomment=[s][\color{JavaDoc}\itshape]{'}{*/},
%	morecomment=[s][\color{JavaDoc}\itshape]{'}{`},
	literate=
	{`&&}{{$\scriptscriptstyle \wedge$}}1
	{`<=}{{$\scriptscriptstyle \leq$}}1
	{`>=}{{$\scriptscriptstyle \geq$}}1
	{`<>}{{$\scriptscriptstyle \neq$}}1
	{`!=}{{$\scriptscriptstyle \neq$}}1
	{`/=}{{$\scriptscriptstyle \neq$}}1
	{`<-}{{$\scriptscriptstyle \in$}}1
	{`!<-}{{$\scriptscriptstyle \notin$}}1
	{ä}{{\"a}}1
	{ö}{{\"o}}1
	{ü}{{\"u}}1
	{ß}{{\ss}}1
	}

% create titlepage
\renewcommand{\maketitle}{
	\begin{titlepage}
	\begin{flushright}
	\vspace*{1.5cm}
	\vspace*{1.5cm}
	\vspace*{1.5cm}
			{\huge\LARGE\@title}\\[1.25cm] 
			{\Large\@author}\\[4cm]
			\hspace*{.11cm}
			\normalsize
			Berlin, \today  
	\end{flushright}
	\end{titlepage}
}